from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.

class User(AbstractUser):
    telephone = models.CharField(max_length=11, verbose_name='手机号')
    avatar = models.ImageField(upload_to='avatar',default='avatar/default.png', verbose_name='头像')
    gender = models.IntegerField(choices=((0,'男'),(1, '女'),(2,'其它')), verbose_name='性别', default=2)
    # userdetail = models.OneToOneField(to='UserDetail', on_delete=models.DO_NOTHING,db_constraint=False,null=True ,verbose_name='用户详情')
    weixin = models.CharField(max_length=32, verbose_name='微信号', null=True)
    qq = models.IntegerField(verbose_name='QQ 号', null=True)


    class Meta:
        verbose_name_plural = '用户表'

    def __str__(self):
        return '%s'%self.username

class UserDetail(models.Model):
    choice_status = (
        (0, '未实名'),
        (1, '已实名'),
    )
    certification = models.BooleanField(choices=choice_status, default=0, verbose_name='实名认证')
    class Meta:
        verbose_name_plural='用户详情表'



